package org.misalen.web.service.push;

import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 
 * 
 * 
 * 推送参数
 * 
 * 
 * 
 * @author guochao
 *
 * 
 * 
 */
public class PushParameter {
	private String title;
	private String type;
	private boolean isNotification;
	private List<String> token;
	private Map<String, String> extra = new HashMap<String, String>();

	public Map<String, String> getExtra() {
		return extra;
	}

	public void setExtra(Map<String, String> extra) {
		this.extra = extra;
	}

	public PushParameter addExtra(String key, String value) {
		this.extra.put(key, value);
		return this;
	}

	public String getTitle() {
		return title;
	}

	public PushParameter setTitle(String title) {
		this.title = title;
		return this;
	}

	public String getType() {
		return type;
	}

	public PushParameter setType(String type) {
		this.type = type;
		return this;
	}

	public boolean isNotification() {
		return isNotification;
	}

	public PushParameter setNotification(boolean isNotification) {
		this.isNotification = isNotification;
		return this;
	}

	public List<String> getToken() {
		return token;
	}

	public PushParameter addToken(String... token) {
		if (this.token == null) {
			this.token = new ArrayList<>();
		}
		Collections.addAll(this.token, token);
		return this;
	}

	public PushParameter addToken(List<String> token) {
		if (this.token == null) {
			this.token = new ArrayList<>();
		}
		token.addAll(token);
		return this;
	}

	public PushParameter setToken(List<String> token) {
		this.token = token;
		return this;
	}
}
